<h1>订单管理 - <span id="secondHeading">回填发货单号</span></h1>
<%= javascript_include_tag "prototype" %>
<script type="text/javascript">
    function querylast_serial(){
        var url = '/ajax/get_lastserial';
        var pars = '';
        var myAjax = new Ajax.Request(url,{
                method: 'get', 
                parameters:pars, 
                onComplete: showResponseserial
            });
    }

  function querylast_date(){
        var url = '/ajax/get_lastdate';
        var pars = '';
        var myAjax = new Ajax.Request(url,{
                method: 'get', 
                parameters:pars, 
                onComplete: showResponsedate
            });
    }
                
    function showResponseserial(originalRequest){
        var lastserial = originalRequest.responseText;   
        if (lastserial==null){
            alert("无法载入上次输入发货单号,请稍候再试.");
            return 0;
        }
        $("lastserial").innerText = "上次输入的发货单号为：" + lastserial ;
    }

  function showResponsedate(originalRequest){
        var lastdate = originalRequest.responseText;   
        if (lastdate==null){
            alert("无法载入上次输入交货日期,请稍候再试.");
            return 0;
        }
        $("lastdate").innerText = "上次输入的交货日期为：" + lastdate ;
    }
</script>


订单编号:<%=@salePaper.id%>
<%=form_tag({}, :id=>"input-form")%>
<TABLE border="0" id="INPUT_TABLE">
<%=hidden_field_tag(:paper_id,@salePaper.id)%>   
<%=hidden_field_tag(:item_id,params[:id])%>
    <TR>
        <TD>发货单号：</TD>
        <TD><input type="text" name="serial" size="30" maxlength="20" value="<%=@salePaperitem.serial%>"></TD>
        <TD id="lastserial"><a href="javascript:querylast_serial();">取得上次填写发货单号</a></TD>
    </TR>
    <TR>
        <td>交货日期：</td>
        <td>
        <script language=javascript>
        var bir_Date=new dateSelector('<%= @salePaperitem.get_date_at %>');
        bir_Date.inputID='get_date_at';
        bir_Date.inputName='get_date_at';
        bir_Date.display();
        </script>
        </td>
        <TD id="lastdate"><a href="javascript:querylast_date();">取得上次交货日期</a></TD>
    </tr>
    <tr>
        <TD><input type="submit" class="sub" value="回填"></TD>
    </TR>
</TABLE>
<%=end_form_tag%>
